<template>
    <div style="padding: 5% 10%; color: #000!important;height: calc(100vh - 12%)">
        <Row style="flex-wrap: wrap;height: 100%;justify-content: center" type="flex" :gutter="50">
            <i-col span="15" style="padding-right: 10%">
                <div style="font-weight: 700;" class="calculation-form">
                    <Form :label-width="110" label-position="left">
                        <Row>
                            <i-col span="24">
                                <p style="font-size: 14px;color: #929292;margin-bottom: 20px; cursor: pointer" @click="$router.push({ name: 'WorkbenchIndex' })">
                                    <Icon type="ios-arrow-round-back" size="30" style="font-weight: 700;" />
                                    返回首页
                                </p>
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="24">
                                <p style="font-size: 25px;margin-bottom: 20px">投诉建议</p>
                            </i-col>
                        </Row>
                        <Row style="margin-bottom: 50px">
                            <i-col span="24">
                                <p style="font-size: 14px;">我们将尽快联系被投诉方</p>
                            </i-col>
                        </Row>
                        <Row v-if="formInfo.matterCode < 5">
                            <i-col span="24">
                                <FormItem label="运营企业: ">
                                    <Select v-model="formInfo.companyId" size="large" placeholser="请选择" clearable style="width: 100%;">
                                        <i-option v-for="(item, index) in companyList" :key="index" :label="item.companyName" :value="item.id" />
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row v-else>
                            <i-col span="24">
                                <FormItem label="仓库名称: ">
                                    <Select v-model="formInfo.companyId" size="large" placeholser="请选择" clearable style="width: 100%;" @on-change="wareListChange">
                                        <i-option v-for="(item, index) in wareList" :key="index" :label="item.whName" :value="item.id" />
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="24">
                                <FormItem label="事项类别: ">
                                    <RadioGroup v-model="formInfo.matterCode" @on-change="matterCodeChange">
                                        <Radio v-for="item in eventCategoryList" :key="item.id" size="large" :label="item.dictValue">{{item.dictName}}</Radio>
                                    </RadioGroup>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row v-if="formInfo.matterCode !== '4'" >
                            <i-col span="24">
                                <FormItem label="单号: ">
                                    <Input v-model="formInfo.businessNum" size="large">
                                        <Button slot="append" @click="obtain">获取业务信息</Button>
                                    </Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row v-if="formInfo.matterCode !== '4'" style="border-bottom: 1px solid #e7e7e7;padding-bottom: 10px; margin-bottom: 20px">
                            <i-col span="24">
                                业务单概况
                            </i-col>
                        </Row>
                        <template v-if="formInfo.matterCode === '1'">
                            <Row>
                                <i-col span="24">
                                    <FormItem label="合同类型: ">
                                        <Input v-model="formInfo.businessType" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="上游供货商: ">
                                        <Input v-model="formInfo.entrustedEnterprise" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="合同品类: ">
                                        <Input v-model="formInfo.matType" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="合同重量: ">
                                        <Input v-model="formInfo.measureQtyAgmt" size="large" readonly>
                                            <p slot="append">
                                                吨
                                            </p>
                                        </Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="合同金额: ">
                                        <Input v-model="formInfo.htTotalAmount" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                        </template>

                        <template v-if="formInfo.matterCode === '2'">
                            <Row>
                                <i-col span="24">
                                    <FormItem label="流转类型: ">
                                        <Input v-model="formInfo.transType" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="结算金额: ">
                                        <Input v-model="formInfo.lzTotalAmount" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                        </template>

                        <template v-if="formInfo.matterCode === '3'">
                            <Row>
                                <i-col span="24">
                                    <FormItem label="预计到港时间: ">
                                        <Input v-model="formInfo.estimateDate" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="箱型箱量: ">
                                        <Input v-model="formInfo.boxType" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="抵运港: ">
                                        <Input v-model="formInfo.arrivalPier" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                        </template>

                        <template v-if="formInfo.matterCode === '5'">
                            <Row>
                                <i-col span="24">
                                    <FormItem label="货主: ">
                                        <Input v-model="formInfo.dataInfo.customerName" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="提单号: ">
                                        <Input v-model="formInfo.dataInfo.billOfLandingNo" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="箱号: ">
                                        <Input v-model="formInfo.dataInfo.businessItem" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="品名: ">
                                        <Input v-model="formInfo.dataInfo.matName" size="large" readonly>
                                        </Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="入库日期: ">
                                        <Input v-model="formInfo.dataInfo.dateInto" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="送货车号: ">
                                        <Input v-model="formInfo.dataInfo.carNo" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="作业要求: ">
                                        <Input v-model="formInfo.dataInfo.operationRequirements" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                        </template>

                        <template v-if="formInfo.matterCode === '6'">
                            <Row>
                                <i-col span="24">
                                    <FormItem label="货主: ">
                                        <Input v-model="formInfo.dataInfo.customerName" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="箱号: ">
                                        <Input v-model="formInfo.dataInfo.businessItem" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="品名: ">
                                        <Input v-model="formInfo.dataInfo.matName" size="large" readonly>
                                        </Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="出库日期: ">
                                        <Input v-model="formInfo.dataInfo.outStartDate" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="提货车号: ">
                                        <Input v-model="formInfo.dataInfo.carNo" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="作业要求: ">
                                        <Input v-model="formInfo.dataInfo.operationRequirements" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                        </template>

                        <template v-if="formInfo.matterCode === '8'">
                            <Row>
                                <i-col span="24">
                                    <FormItem label="分色类型: ">
                                        <Input v-model="formInfo.dataInfo.businessType" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="分色日期: ">
                                        <Input v-model="formInfo.dataInfo.dateStart" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="分色前品名: ">
                                        <Input v-model="formInfo.dataInfo.matName" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="分色后品名: ">
                                        <Input v-model="formInfo.dataInfo.matNameOld" size="large" readonly>
                                        </Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                        </template>

                        <template v-if="formInfo.matterCode === '7'">
                            <Row>
                                <i-col span="24">
                                    <FormItem label="原货主: ">
                                        <Input v-model="formInfo.dataInfo.ownerName" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="新货主: ">
                                        <Input v-model="formInfo.dataInfo.newOwnerName" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="原结算客户: ">
                                        <Input v-model="formInfo.dataInfo.settlementCustomerName" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="新结算客户: ">
                                        <Input v-model="formInfo.dataInfo.newSettlementCustomerName" size="large" readonly>
                                        </Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="箱号: ">
                                        <Input v-model="formInfo.dataInfo.wmsBatchNum" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="货转日期: ">
                                        <Input v-model="formInfo.dataInfo.createdTime" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row>
                                <i-col span="24">
                                    <FormItem label="品名: ">
                                        <Input v-model="formInfo.dataInfo.matName" size="large" readonly></Input>
                                    </FormItem>
                                </i-col>
                            </Row>
                        </template>

                        <Row v-if="formInfo.matterCode != '4'">
                            <i-col span="24">
                                <FormItem label="业务员: ">
                                    <Input v-model="formInfo.businessBy" size="large" readonly></Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row v-if="formInfo.matterCode == '5' || formInfo.matterCode == '6' || formInfo.matterCode == '7' || formInfo.matterCode == '8'">
                            <i-col span="24">
                                <FormItem label="岗位: ">
                                    <Input v-model="formInfo.businessDepart" size="large" readonly></Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row v-if="formInfo.matterCode == '1' || formInfo.matterCode == '3'">
                            <i-col span="24">
                                <FormItem label="业务员部门: ">
                                    <Input v-model="formInfo.businessDepart" size="large" readonly></Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row v-if="formInfo.matterCode != '4'">
                            <i-col span="24">
                                <FormItem label="业务员电话: ">
                                    <Input v-model="formInfo.businessTel" size="large" readonly></Input>
                                </FormItem>
                            </i-col>
                        </Row>

                        <Row>
                            <i-col span="24">
                                <FormItem label="投诉内容: ">
                                    <Input v-model="formInfo.backContent" size="large" type="textarea" :rows="4"></Input>
                                </FormItem>
                            </i-col>
                        </Row>


                        <Row style="border-bottom: 1px solid #e7e7e7;padding-bottom: 10px; margin-bottom: 20px">
                            <i-col span="24">
                                联系方式
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="24">
                                <FormItem label="姓名: ">
                                    <Input v-model="formInfo.backName" size="large"></Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="24">
                                <FormItem label="电话: ">
                                    <Input v-model="formInfo.backTel" size="large"></Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="24">
                                <FormItem label="邮箱: ">
                                    <Input v-model="formInfo.backEml" size="large"></Input>
                                </FormItem>
                            </i-col>
                        </Row>

                        <Row>
                            <i-col span="12">
                                <FormItem label="">
                                    <Button size="large" style="background-color: #4f68e8;color: #fff;margin-right: 20px; width: 100%;" @click="submitFeedback" :loading="loading">提交反馈</Button>
                                </FormItem>
                            </i-col>
                        </Row>
                    </Form>
                </div>
            </i-col>
        </Row>
    </div>
</template>

<script>
import baseCodeApi from '@/api/baseCode';
import api from '@/api/feedback';
import { getAllWareList } from '@/api/warehouse/home.js';
import { getWarehousingDtails, page, getColorSeparationInfo,getStockPropChangeDetail,getSepPlanInDtail,getSepPlanInDtailM } from '@/api/planInfo.js'
import _ from 'lodash';
export default {
    name: 'index',
    data() {
        return {
            wmsUrl:'',
            formInfo: {
                companyId: '',
                matterCode: '1',
                backContent: '',
                businessType: '',
                matType: '',
                measureQtyAgmt: null,
                htTotalAmount: null,
                transType: '',
                lzTotalAmount: null,
                estimateDate: null,
                boxType: '',
                arrivalPier: '',
                entrustedEnterprise: '',
                businessBy: '',
                businessDepart: '',
                businessTel: '',
                dataInfo:{}
            },
            companyList: [],
            loading: false,
            dataLoading: false,
            eventCategoryList: [],
            feedbackList: [],
            dictInfo: {
                customerId: []
            },
            wareList:[]
        };
    },
    methods: {
        wareListChange(e){
            this.wmsUrl = this.wareList.filter(item => item.id == e)[0].ipProt
            this.formInfo.dataInfo = {}
            this.formInfo.businessNum = ''
            this.formInfo.businessBy = '';
            this.formInfo.businessDepart = '';
            this.formInfo.businessTel = '';
        },
        matterCodeChange(){
            this.formInfo.dataInfo = {}
            this.formInfo.businessNum = '';
            this.formInfo.businessBy = '';
            this.formInfo.businessDepart = '';
            this.formInfo.businessTel = '';
            this.formInfo.backContent = '';
        },
        getAllCompany() {
            baseCodeApi.getAllUserCompany()
                .then(({ data }) => {
                    if (data.returnCode === 200) {
                        this.companyList = data.returnData;
                    } else {
                        this.$Message.error(data.returnMsg);
                    }
                }).catch(() => {
                    this.$Message.error('网络错误');
                });
        },
        submitFeedback() {
            if (this.formInfo.matterCode === '5' || this.formInfo.matterCode === '6' || this.formInfo.matterCode === '7' || this.formInfo.matterCode === '8') {
                if (!this.formInfo.companyId) {
                    this.$Message.error('请选择仓库');
                    return;
                }
            } else {
                if (!this.formInfo.companyId) {
                    this.$Message.error('请选择运营企业');
                    return;
                }
            }
            if (!this.formInfo.backContent) {
                this.$Message.error('请填写投诉内容');
                return;
            }
            let dataInfo = this.formInfo.dataInfo
            this.$delete(this.formInfo, 'dataInfo')
            let formInfo = {...this.formInfo}
            Object.assign(formInfo, dataInfo);
            this.loading = true;
            api.create(formInfo).then(({ data }) => {
                if (data.returnCode === 200) {
                    this.$Message.success('提交成功');
                    this.initData();
                } else {
                    this.$Message.error(data.returnMsg);
                }
            }).finally(() => {
                this.loading = false;
            });
        },
        initData() {
            this.dataLoading = true;
            let body = {
                pageIndex: 1,
                pageSize: 10000
            }
            api.selectPage(body).then(({ data }) => {
                if (data.returnCode === 200) {
                    this.feedbackList = data.returnData.records;
                } else {
                    this.$Message.error(data.returnMsg);
                }
            }).finally(() => {
                this.dataLoading = false;
            });
        },
        queryGoodsTransOrder() {
            api.queryGoodsTransOrder({transNum: this.formInfo.businessNum}).then(({ data }) => {
                if (data.returnCode === 200) {
                    let { returnData } = data;
                    if (returnData && Object.keys(returnData).length === 0) {
                        this.$Message.warning('暂无数据');
                        return;
                    }
                    this.formInfo.transType = this.$utils.handleDictData(returnData.transType, this.dictInfo.tranType);
                    this.formInfo.lzTotalAmount = returnData.fincenterMoney ? (returnData.fincenterMoney  + '') : '';
                } else {
                    this.$Message.error(data.returnMsg);
                }
            });
        },
        queryBizOrderGoodsAgmt() {
            api.queryBizOrderGoodsAgmt({billLadingNum: this.formInfo.businessNum}).then(({ data }) => {
                if (data.returnCode === 200) {
                    let { returnData } = data;
                    if (returnData && Object.keys(returnData).length === 0) {
                        this.$Message.warning('暂无数据');
                        return;
                    }
                    this.formInfo.estimateDate = returnData.expectedDepartureDate ? returnData.expectedDepartureDate : '';
                    this.formInfo.boxType = returnData.containerQty ? returnData.containerQty : '';
                    this.formInfo.arrivalPier = returnData.finlDestName;
                    this.formInfo.businessBy = returnData.createdByName;
                    this.formInfo.businessDepart = returnData.belongDepart;
                    this.formInfo.businessTel = returnData.createdByTel;
                } else {
                    this.$Message.error(data.returnMsg);
                }
            });
        },
        queryBusinessOrder() {
            api.queryBusinessOrder({orderNum: this.formInfo.businessNum}).then(({ data }) => {
                if (data.returnCode === 200) {
                    let { returnData } = data;
                    if (returnData && Object.keys(returnData).length === 0) {
                        this.$Message.warning('暂无数据');
                        return;
                    }
                    this.formInfo.businessType = this.$utils.handleDictData(returnData.businessType, this.dictInfo.businessType);
                    this.formInfo.entrustedEnterprise = this.$utils.handleDictData(returnData.entrustedEnterprise, this.dictInfo.customerId);
                    this.formInfo.matType = this.getMatTypeName(returnData.matType);
                    this.formInfo.measureQtyAgmt = returnData.measureQtyAgmt ? ((returnData.measureQtyAgmt / 1000)  + '') : '';
                    this.formInfo.htTotalAmount = returnData.agmtCurrency + ' ' + (returnData.htTotalAmount ? (returnData.htTotalAmount  + '') : '');
                    this.formInfo.businessBy = returnData.createdByName;
                    this.formInfo.businessDepart = returnData.belongDepart;
                    this.formInfo.businessTel = returnData.createdByTel;
                } else {
                    this.$Message.error(data.returnMsg);
                }
            });
        },
        getMatTypeName(matTypeStr) {
            if (matTypeStr) {
                let matTypeCodeList = matTypeStr.split(',');
                return  _.uniq(matTypeCodeList).map(x => this.$utils.handleDictData(x, this.dictInfo.matType)).join(',');
            } else {
                return '';
            }
        },
        obtain() {
            if (!this.formInfo.businessNum) {
                this.$Message.warning('请先输入单号');
                return;
            }
            if ((this.formInfo.matterCode === '5' || this.formInfo.matterCode === '6' || this.formInfo.matterCode === '7' || this.formInfo.matterCode === '8')
                && !this.formInfo.companyId) {
                this.$Message.warning('请先选择仓库');
                return;
            }
            if (this.formInfo.matterCode === '1') {
                this.queryBusinessOrder();
            } else if (this.formInfo.matterCode === '2') {
                this.queryGoodsTransOrder();
            } else if (this.formInfo.matterCode === '3') {
                this.queryBizOrderGoodsAgmt();
            }else if (this.formInfo.matterCode === '5'){
                getWarehousingDtails({inPlanOrderNum:this.formInfo.businessNum},this.wmsUrl).then(res=>{
                    if(res.data.returnCode == 200){
                        this.formInfo.dataInfo = {};
                        if(res.data.returnData.length != 0){
                            let operationRequirements = ''
                            if(res.data.returnData[0].ifCodeReading == '1'){
                                operationRequirements = operationRequirements + '抄码 '
                            }
                            if(res.data.returnData[0].intoSeparationChargeSign == '1'){
                                operationRequirements = operationRequirements + '分色 '
                            }
                            if(res.data.returnData[0].nucleicAcidTestFlag == '1'){
                                operationRequirements = operationRequirements + '核酸检测 '
                            }
                            if(res.data.returnData[0].disinfectionSign != 'N'){
                                operationRequirements = operationRequirements + '消毒 '
                            }
                            if(res.data.returnData[0].authenticateFlag == '1'){
                                operationRequirements = operationRequirements + '密钥 '
                            }
                            res.data.returnData[0].operationRequirements = operationRequirements
                            let matName = ''
                            res.data.returnData.forEach(item=>{
                                matName = matName + item.matName + ''
                            })
                            res.data.returnData[0].matName = matName
                            let dataInfo = {
                                customerName: res.data.returnData[0].customerName,
                                billOfLandingNo: res.data.returnData[0].billOfLandingNo,
                                businessItem: res.data.returnData[0].businessItem,
                                matName: res.data.returnData[0].matName,
                                dateInto: this.$utils.timestampToDate(res.data.returnData[0].dateInto),
                                carNo: res.data.returnData[0].carNo,
                                operationRequirements: res.data.returnData[0].operationRequirements
                            }
                            this.formInfo.businessBy = res.data.returnData[0].createdByName;
                            this.formInfo.businessDepart = res.data.returnData[0].createdByDepart;
                            this.formInfo.businessTel = res.data.returnData[0].createdByMobile;
                            this.$set(this.formInfo,'dataInfo', dataInfo)
                        }else{
                        this.$Message.error('暂无数据');
                        }
                    }else{
                        this.$Message.error('暂无数据');
                        this.formInfo.dataInfo = {};
                    }
                })
            } else if (this.formInfo.matterCode === '6') {
                page({outPlanOrderNum: this.formInfo.businessNum},this.wmsUrl).then(res=>{
                    if(res.data.returnCode == 200){
                        this.formInfo.dataInfo = {};
                        if(res.data.returnData.length != 0){
                            if(this.formInfo.companyId == 26 ||this.formInfo.companyId == 37){
                                let datas = {
                                    customerName: res.data.returnData.wmsOutPlanDTO.customerName,
                                    carNo: res.data.returnData.wmsOutPlanDTO.carNo,
                                    outStartDate: this.$utils.timestampToDate(res.data.returnData.wmsOutPlanDTO.outStartDate)
                                }
                                let businessItem = ''
                                let matName = ''
                                if(res.data.returnData.wmsStockDTOList && res.data.returnData.wmsStockDTOList.length > 0){
                                    matName = res.data.returnData.wmsStockDTOList.map(item => item.matName).join(',');
                                    businessItem = res.data.returnData.wmsStockDTOList[0].batchAttr07
                                }else{
                                    matName = res.data.returnData.separationOrderParentList.map(item => item.matName).join(',');
                                    businessItem = res.data.returnData.separationOrderParentList[0].batchAttr07
                                }
                                datas.businessItem = businessItem
                                datas.matName = matName
                                datas.operationRequirements = ''

                                if(res.data.returnData.wmsStockDTOList.length == 0){
                                    res.data.returnData.stockSeparationPlanDetail[0].separationPlanChildDetailList.forEach((item,index)=>{
                                        if(item.isScanSn == '1'){
                                            datas.operationRequirements = datas.operationRequirements + '抄码 '
                                        }
                                    })
                                }else{
                                    res.data.returnData.wmsStockDTOList.forEach(item =>{
                                        if(item.isScanSn == '1'){
                                            datas.operationRequirements = datas.operationRequirements + '抄码 '
                                        }
                                    })
                                }

                                if(res.data.returnData.wmsOutPlanDTO.businessType == '60'||res.data.returnData.wmsOutPlanDTO.businessType == '61' || res.data.returnData.wmsOutPlanDTO.businessType == '62'){
                                    datas.operationRequirements = datas.operationRequirements + '分色 '
                                }
                                if(res.data.returnData.wmsOutPlanDTO.escort == '1'){
                                    datas.operationRequirements = datas.operationRequirements + '押车 '
                                }
                                this.formInfo.businessBy = res.data.returnData.wmsOutPlanDTO.createdByName;
                                this.formInfo.businessDepart = res.data.returnData.wmsOutPlanDTO.createdByDepart;
                                this.formInfo.businessTel = res.data.returnData.wmsOutPlanDTO.createdByMobile;
                                this.$set(this.formInfo,'dataInfo', datas)
                            } else {
                                let datas = {
                                    customerName: res.data.returnData.wmsOutPlanDTO.customerName,
                                    carNo: res.data.returnData.wmsOutPlanDTO.carNo,
                                    outStartDate: this.$utils.timestampToDate(res.data.returnData.wmsOutPlanDTO.outStartDate)
                                }
                                let businessItem = ''
                                let matName = ''
                                if (res.data.returnData.wmsStockDTOList && res.data.returnData.wmsStockDTOList.length > 0) {
                                    matName = res.data.returnData.wmsStockDTOList.map(item => item.matName).join(',');
                                    businessItem = res.data.returnData.wmsStockDTOList[0].batchAttr07
                                } else {
                                    matName = res.data.returnData.stockSeparationPlanDetail[0].separationPlanChildDetailList.map(item => item.matName).join(' ');
                                    businessItem = res.data.returnData.stockSeparationPlanDetail[0].separationPlanChildDetailList[0].batchAttr07
                                }
                                datas.businessItem = businessItem
                                datas.matName = matName
                                datas.operationRequirements = ''
                                if (res.data.returnData.wmsStockDTOList.length == 0) {
                                    res.data.returnData.stockSeparationPlanDetail[0].separationPlanChildDetailList.forEach((item,index) => {
                                        if (item.isScanSn == '1') {
                                            datas.operationRequirements = datas.operationRequirements + '抄码 '
                                        }
                                    })
                                } else {
                                    res.data.returnData.wmsStockDTOList.forEach(item => {
                                        if (item.isScanSn == '1') {
                                            datas.operationRequirements = datas.operationRequirements + '抄码 '
                                        }
                                    })
                                }

                                if(res.data.returnData.wmsOutPlanDTO.businessType == '60'){
                                    datas.operationRequirements = datas.operationRequirements + '分色 '
                                }
                                if(res.data.returnData.wmsOutPlanDTO.escort == '1'){
                                    datas.operationRequirements = datas.operationRequirements + '押车 '
                                }
                                this.formInfo.businessBy = res.data.returnData.wmsOutPlanDTO.createdByName;
                                this.formInfo.businessDepart = res.data.returnData.wmsOutPlanDTO.createdByDepart;
                                this.formInfo.businessTel = res.data.returnData.wmsOutPlanDTO.createdByMobile;
                                this.$set(this.formInfo,'dataInfo', datas)
                            }

                        } else {
                            this.$Message.error('暂无数据');
                        }
                    } else {
                        this.$Message.error('暂无数据');
                        this.formInfo.dataInfo = {};
                    }
                })
            } else if (this.formInfo.matterCode === '8'){
                getSepPlanInDtail({orderNum: this.formInfo.businessNum, dataSource: "2"},this.wmsUrl).then(res=>{
                    this.formInfo.dataInfo = {}
                    let matName = ''
                    let matNameOld = ''
                    if (res.data.returnData && res.data.returnData.length > 0) {
                        matName = res.data.returnData.map(x => x.matName).join(' ');
                    } else {
                        this.$Message.error('暂无数据');
                    }

                    getSepPlanInDtailM({orderNum: this.formInfo.businessNum, dataSource: "2"},this.wmsUrl).then(res=>{
                        if (res.data.returnData && res.data.returnData.length > 0) {
                            matNameOld = res.data.returnData.map(x => x.matName).join(' ');
                            let businessType = ''
                            let dateStart = this.$utils.timestampToDate(res.data.returnData[0].dateStart)
                            if (res.data.returnData[0].businessType) {
                                if (res.data.returnData[0].businessType == 60) {
                                    businessType = '出库分色'
                                }else if(res.data.returnData[0].businessType == 61){
                                    businessType = '在库分色'
                                }else if(res.data.returnData[0].businessType == 62){
                                    businessType = '入库分色'
                                }
                            } else if (res.data.returnData[0].orderType) {
                                if (res.data.returnData[0].orderType == '60') {
                                    businessType = '出库分色'
                                }else if(res.data.returnData[0].orderType == '61'){
                                    businessType = '在库分色'
                                }else if(res.data.returnData[0].orderType == '62'){
                                    businessType = '入库分色'
                                }
                            }
                            let dataInfo = {
                                matName,
                                matNameOld,
                                businessType,
                                dateStart
                            }
                            this.formInfo.businessBy = res.data.returnData[0].createdByName;
                            this.formInfo.businessDepart = res.data.returnData[0].createdByDepart;
                            this.formInfo.businessTel = res.data.returnData[0].createdByMobile;
                            this.$set(this.formInfo, 'dataInfo', dataInfo )
                        }
                    })
                })
            } else if (this.formInfo.matterCode === '7'){
                getStockPropChangeDetail({orderNum: this.formInfo.businessNum},this.wmsUrl).then(res=>{
                    if (res.data.returnData) {
                        this.formInfo.dataInfo = {}
                        let dataInfo = {
                            createdTime: this.$utils.timestampToDate(res.data.returnData.createdTime),
                            wmsBatchNum: res.data.returnData.wmsBatchNum,
                            ownerName: res.data.returnData.ownerName,
                            newOwnerName: res.data.returnData.newOwnerName,
                            settlementCustomerName: res.data.returnData.settlementCustomerName,
                            newSettlementCustomerName: res.data.returnData.newSettlementCustomerName,
                            matName:res.data.returnData.matName
                        }
                        this.formInfo.businessBy = res.data.returnData.createdByName;
                        this.formInfo.businessDepart =  res.data.returnData.createdByDepart;
                        this.formInfo.businessTel = res.data.returnData.createdByMobile;
                        this.$set(this.formInfo, 'dataInfo', dataInfo )
                    } else {
                        this.$Message.error('暂无数据');
                    }
                })
            }
        },

        getDictData() {
            baseCodeApi.getOftenTypeByUserId().then(({ data }) => {
                if (data.returnCode === 200) {
                    this.dictInfo.matType = data.returnData.map(i => {
                        return {
                            dictName: i.companyMatName,
                            dictValue: i.companyMatCode
                        };
                    });
                } else {
                    this.$Message.error(data.returnMsg, 'error');
                }
            }).catch(err => {
                console.log(err);
            });
            baseCodeApi.getContractDictData().then(({ data }) => {
                if (data.returnCode === 200) {
                    const { platformWarehouseList, customerList } = data.returnData;
                    this.dictInfo.whCode = platformWarehouseList.map(i => {
                        return {
                            dictName: i.whName,
                            dictValue: i.id
                        };
                    });
                    this.dictInfo.customerId = customerList.map(i => {
                        return {
                            dictName: i.customerName,
                            dictValue: i.id,
                            customerCode: i.customerCode
                        };
                    });
                } else {
                    this.$Message.error(data.returnMsg);
                }
            }).catch(err => {
                console.log(err);
            });

            // 字典
            baseCodeApi.getDictDataByDictTypeList([
                'CONTRACT_STATUS',
                'INVOICE_TYPE',
                'FLIE_TYPE',
                'BUSINESS_TYPE',
                'FEE',
                'BILL_TYPE',
                'ORDER_BUSINESS_TYPE',
                'AGENCY_FEE_TYPE',
                'REPAYMENT_TYPE',
                'RELEASE_TYPE',
                'CHARGE_DIMENSION',
                'DEDUCTION_METHOD',
                'CHARGING_METHOD',
                'PaymentMethod',
                'PAY_COLLECT_FLAG',
                'TRADE_TYPE',
                'TRANS_STATUS',
                'TRADE_MODE',
                'CHARGE_STATUS',
                'DAMAGED_SIGN',
                'CIRCULATION_STATUS',
                'PAYMENT_STATUS',
                'CIRCULATION_TYPE',
                'MATTER_CODE',
                'BILL_STATUS'
            ]).then(({ data }) => {
                if (data.returnCode === 200) {
                    const { returnData } = data;
                    this.dictInfo.dictArr = returnData;
                    this.eventCategoryList = returnData.filter(item => item.dictType === 'MATTER_CODE');
                    this.dictInfo.contractStatus = returnData.filter(item => item.dictType === 'CONTRACT_STATUS');
                    this.dictInfo.businessType = returnData.filter(item => item.dictType === 'ORDER_BUSINESS_TYPE');
                    this.dictInfo.agencyFeesCalType = returnData.filter(item => item.dictType === 'AGENCY_FEE_TYPE');
                    this.dictInfo.repaymentType = returnData.filter(item => item.dictType === 'REPAYMENT_TYPE');
                    this.dictInfo.tradeMode = returnData.filter(item => item.dictType === 'TRADE_MODE');
                    this.dictInfo.releaseType = returnData.filter(item => item.dictType === 'RELEASE_TYPE');
                    this.dictInfo.measureUnit = returnData.filter(item => item.dictType === 'CHARGE_DIMENSION');
                    this.dictInfo.invotp = returnData.filter(item => item.dictType === 'INVOICE_TYPE');
                    this.dictInfo.fileType = returnData.filter(item => item.dictType === 'FLIE_TYPE');
                    this.dictInfo.earnestMoneyDeductionMethod = returnData.filter(item => item.dictType === 'DEDUCTION_METHOD');
                    this.dictInfo.agencyChargingMethod = returnData.filter(item => item.dictType === 'CHARGING_METHOD');
                    this.dictInfo.PaymentMethod = returnData.filter(item => item.dictType === 'PaymentMethod');
                    this.dictInfo.currency = returnData.filter(item => item.dictType === 'FEE');
                    this.dictInfo.sfbz = returnData.filter(item => item.dictType === 'PAY_COLLECT_FLAG');
                    this.dictInfo.bustype = returnData.filter(item => item.dictType === 'BUSINESS_TYPE');
                    this.dictInfo.formsOfCommerce = returnData.filter(item => item.dictType === 'TRADE_TYPE');
                    this.dictInfo.transStatus = returnData.filter(item => item.dictType === 'TRANS_STATUS');
                    this.dictInfo.billType = returnData.filter(item => item.dictType === 'BILL_TYPE');
                    this.dictInfo.chargeStatus = returnData.filter(item => item.dictType === 'CHARGE_STATUS');
                    this.dictInfo.damagedSign = returnData.filter(item => item.dictType === 'DAMAGED_SIGN');
                    this.dictInfo.circulationType = returnData.filter(item => item.dictType === 'CIRCULATION_STATUS');
                    this.dictInfo.paymentStatus = returnData.filter(item => item.dictType === 'PAYMENT_STATUS');
                    this.dictInfo.tranType = returnData.filter(item => item.dictType === 'CIRCULATION_TYPE');
                    this.dictInfo.billStatus = returnData.filter(item => item.dictType === 'BILL_STATUS');
                    console.log(this.eventCategoryList,'eventCategoryList')
                } else {
                    this.$Message.error(data.returnMsg);
                }
            }).catch(err => {
                console.log(err);
            });
        },
        fetchWareList() {
            getAllWareList().then(({ data }) => {
                if(data.returnCode == 200){
                    this.wareList = data.returnData
                }
            })
        }
    },
    mounted() {
        this.getAllCompany();
        this.getDictData();
        this.initData();
        this.fetchWareList();
        this.formInfo.backName = this.$utils.getUserInfo().realName;
        this.formInfo.backTel = this.$utils.getUserInfo().mobile;
        this.formInfo.backEml = this.$utils.getUserInfo().email;
    }
}
</script>

<style scoped lang="less">
.feedback-data {
    border-bottom: 1px solid #e7e7e7;
    padding-bottom: 20px;
    margin-bottom: 30px;
    word-break: break-all;
    .content {
        padding: 20px;
        background-color: #f4f7fa;
        font-size: 14px;
        color: #929292;
        font-weight: 700;
    }
}
</style>
<style lang="less">
.calculation-form, .right-result {
    font-size: 14px !important;
    .ivu-form-item-label {
        font-size: 14px !important;
        color: #000;
    }
    .ivu-checkbox-wrapper {
        font-size: 14px !important;
        color: #000;
    }
    .ivu-input, .ivu-input-group-append, .ivu-input-number-input {
        border: none !important;
        background-color: #eaeff5;
    }
    .ivu-checkbox-checked .ivu-checkbox-inner {
        background-color: #4f68e8 !important;
    }
}
</style>
